package com.core.baseDao.extend;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.LockMode;
import org.springframework.orm.hibernate3.HibernateTemplate;

/**
 * Manager基类，调用GenericDAO实现实体的CRUD操作
 * @author
 * @param <T> 实体类型
 * @param <PK> 实体主键类型
 */
public abstract interface BaseEntityDao<T, PK extends Serializable> {
    /**
     * Log variable for all child classes. Uses LogFactory.getLog(getClass()) from Commons Logging
     */

	public T load(PK id);

	public T get(PK id);

	public boolean contains(T t);

	public void refresh(T t);

	public Serializable save(T t);

	public void saveOrUpdate(T t);

	public void saveOrUpdateAll(Collection<T> entities);

	public void update(T t, LockMode lockMode);

	public void update(T t);

	public void delete(T t, LockMode lockMode);

	public void delete(T t);

	public void deleteAll(Collection<T> entities);

	public List<T> find(String queryString, Object value) ;

	public List<T> find(String queryString, Object[] values) ;

	public List<T> find(String queryString) ;

	public List<T> getAll();
	
	public List<T> findByNamedQuery(String queryName) ;

	public List<T> findByNamedQuery(String queryName, Object value);

	public List<T> findByNamedQuery(String queryName, Object[] values);

	public Object findUnique(final String queryString, final Object[] values);
	
	public boolean exists(PK id);
	
	@Deprecated
	public HibernateTemplate getHibernate();
	public Pager getByPage(String hql,Pager pager);
}
